<?php
/* @var $this TuanController */

?>
<!--左栏  start-->
<div class="col_main w_770 f_l bg_fff">
	<div class="tuan_cont">
		<h2 class="fs_20 ff_yh"><?php echo CHtml::encode($model->zpt_title)?></h2>
		<div class="contbox c_f">
			<div class="cont_l f_l">
				<div class="buy">
				<?php if($model->zpt_start_time>time()){?>
					<div class="cont_buy soon "><span class="f_r">即将开始</span><strong class="c_white"><em>&yen;</em><?php echo $model->zpt_price?></strong></div>
				<?php }else{?>
					<?php if($model->product->zp_inventory>0){?>
						<div class="cont_buy"><?php echo CHtml::link('',array('/home/product/detail','id'=>$model->zp_id,'active'=>'tuan'),array('class'=>'btn f_r','alt'=>'参团'))?></a><strong class="c_white"><em>&yen;</em><?php echo $model->zpt_price?></strong></div>
					<?php }else{?>
						<div class="cont_buy sellout "><span class="f_r">卖光了...</span><strong class="c_white"><em>&yen;</em><?php echo $model->zpt_price?></strong></div>
					<?php }?>
				<?php }?>
				</div>
				<ul class="cont_price c_f fs_14">
					<li><span class="c_666 d_b">原价</span><del class="fw_b ff_yh">&yen;<?php echo $model->zpt_saleprice?></del></li>
					<li><span class="c_666 d_b">折扣</span><span class="fw_b"><?php echo $model->zpt_discount?>折</span></li>
					<li class="no_border"><span class="c_666 d_b">节省</span><span class="fw_b ff_yh">&yen;<?php echo ($model->zpt_saleprice-$model->zpt_price)?></span></li>
				</ul>
				<div class="cont_sold t_c">
					<p class=""><strong class="fs_24 c_orange"><?php echo empty($model->zpt_salenums)?0:$model->zpt_salenums?></strong>人已购买</p>
					<?php if($model->zpt_start_time>time()){?>
						<p class="soon fs_17 ff_yh c_666">团购即将开始,敬请期待！</p>
					<?php }else{?>
						<?php if($model->product->zp_inventory>0){?>
							<p class="fs_17 ff_yh c_666">数量有限，赶快抢购</p>
						<?php }else{?>
							<p class="sellout fs_17 ff_yh c_666">已经卖光啦，下次早点来吧!</p>
						<?php }?>
					<?php }?>
				</div>
				<div class="cont_time c_999 t_c" id="timer"><span id="clock_txt"></span><span id="clock"></span></div>
				<div class="cont_share c_f">
					<p class="share_link">
						<span>分享：</span>
						<input class="t_ipt" type="text" value="<?php echo  Yii::app()->request->hostInfo.Yii::app()->request->url?>" maxlength="200" />
						<button type="button" onclick="void(0)" id="btnCopy_1" copyContent="<?php echo  Yii::app()->request->hostInfo.Yii::app()->request->url?>" class="btn">复制</button>
					</p>
					<!-- Baidu Button BEGIN -->
					<div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">
						<a class="bds_tsina">新浪微博</a>
						<a class="bds_tqq">腾讯微博</a>
						<span class="bds_more">更多</span>
					</div>
				<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=3904611" ></script>
				<script type="text/javascript" id="bdshell_js"></script>
				<script type="text/javascript">
					document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + new Date().getHours();
				</script>
				<!-- Baidu Button END -->
				</div>
			</div>
			<div class="cont_r f_l">
				<div class="c_img"><?php echo CHtml::link(Tool::thumb($model->zpt_pic,480,320,$model->zpt_title),'javascript:')?></div>
			</div>
		</div>
		<div class="cont_other t_r">
			<span class="c_999 ">想了解更多商品信息</span>
			<?php echo CHtml::link('点击查看',array('/home/product/detail','id'=>$model->zp_id,'active'=>'tuan'),array('class'=>'btn','alt'=>'点击查看'))?>
		</div>
	</div>
	<div class="tuan_info" id="tuanTab">
		<div class="tab_hd2 bg_x">
			<ul class="c_f fs_14 fw_b c_666">
				<li><a href="javascript:">团购详情</a></li>
				<li><a href="javascript:">团购订单</a></li>
			</ul>
		</div>
		<div class="tab_cont2">
			<div class="info">
				<?php echo CHtml::decode($model->zpt_content)?>
			</div>
		</div>
		<div class="tab_cont2">
			<div class="order">
				<table class="order_tab" width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                            <th width="22%">买家</th>
                            <th width="25%">宝贝名称</th>
                            <th width="13%">拍下价格</th>
                            <th width="10%">购买数量</th>
                            <th width="20%">成交时间</th>
                            <th width="10%">状态</th>
                        </tr>
                 </table>
				<?php   
					$this->widget('zii.widgets.CListView', array(  
					    'dataProvider'=>$tuanOrder->search(20),  
					    'itemView'=>'_tuan_order_view',    
					    'emptyText'=>'暂时没有数据',  
						'updateSelector'=> 'true',
						'pager'=>array('class'=>'CLinksPager'),
						'buttonCssClass'=>'bg_x btn_page',
						'pagerTemplate'=>'onlyPager',
					 ));  
				?> 
				
			</div>
		</div>
	</div>
</div> 
<!--左栏  end-->
<!--右栏  start-->
<div class="col_sub w_180 f_r">
	<div class="ad"><a href="javascript:" title=""><img src="/images/tuan_ad1.jpg" alt="" /></a></div>
	<div class="hr_12"></div>
	<div class="tuan_tj list_hover bg_fff">
		<div class="hd ff_yh fs_16">热团推荐<span class="bg hot"></span></div>
		<div class="bd">
			<ul>
			<!-- 推荐位-热团推荐 -->
			<?php $positdata = Positions::model()->getPosData('34');?>
			<?php foreach($positdata as $data){?>
				<li class="item">
					<div class="c_img">
						<?php echo CHtml::link(Tool::thumb($data->tuan->zpt_pic,160,106,$data->tuan->zpt_title),array('detail','id'=>$data->tuan->zpt_id))?>
					</div>
					<p class="title title_pro1 c_666 t_c"><?php echo CHtml::link(mb_substr($data->tuan->zpt_title,0,22,'utf8'),array('detail','id'=>$data->tuan->zpt_id))?></p>
					<p class="price t_c"><del class="c_666">原价&yen;<?php echo $data->tuan->zpt_saleprice?></del><strong class="fs_16 c_red2">&yen;<?php echo $data->tuan->zpt_price?></strong></p>
				</li>
			<?php }?>
			</ul>
		</div>
	</div>
	<div class="ad mt10"><a href="javascript:" title=""><img src="/images/tuan_ad1.jpg" alt="" /></a></div>
	<div class="ad mt10"><a href="javascript:" title=""><img src="/images/tuan_ad1.jpg" alt="" /></a></div>
</div>
<!--右栏  end-->    

<link href="<?php echo Yii::app()->request->baseUrl; ?>/css/style/style_tuan.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/tg_timer.js"></script>
<script>
$(function(){
	$('#tuanTab').TabADS2();
	window.shop_status = "<?php echo ($model->zpt_start_time>time())?'0':(($model->zpt_end_time<time())?'3':(($model->product->zp_inventory>0)?'1':'3'))?>";//来源于服务器的团购进行状态
	window.server_time = "<?php echo date('Y/m/d H:i:s')?>";//来源于服务器的当前时间
	window.stime = "<?php echo date('Y/m/d H:i:s',$model->zpt_start_time)?>";//来源于服务器的开始时间
	window.ctime = "<?php echo date('Y/m/d H:i:s',$model->zpt_end_time)?>";//来源于服务器的结束时间
	$('#timer').clockon();
});
</script>

<script src="<?php echo Yii::app()->baseUrl;?>/js/ZeroClipboard/ZeroClipboard.js"></script>    
<script type="text/javascript">  
$(function(){    
    //设置ZeroClipboard.swf的路径    
    ZeroClipboard.setMoviePath("<?php echo Yii::app()->baseUrl;?>/js/ZeroClipboard/ZeroClipboard.swf");     
    $("a[id^=btnCopy_]").each(function(){    
        var clip = new ZeroClipboard.Client();      
        clip.setHandCursor(true);     
            
        var obj = $(this);    
        var id = $(this).attr("id");    
        var content = $(this).attr("copyContent");    
        clip.setText(content);      
        clip.glue(id);    
            
        //这个是复制成功后的提示      
        clip.addEventListener( "complete", function(){      
            art.dialog({  
                title: '复制图片地址',  
                okValue:'确认',  
                content:"已经复制到剪切板！<br>"+"\n"+content,  
                ok: function () {  
                    return true;  
                },  
              });   
        });     
    });    
});  
</script> 